package com.karina.visualization.chart.component;

import com.karina.visualization.chart.client.DisplayObject;
import com.karina.visualization.chart.client.Series;
import com.karina.visualization.chart.model.CategorizedSeriesModel;
import com.karina.visualization.chart.model.ShapeModel;
import com.karina.visualization.chart.skins.ColumnSkin;

public class ColumnSeries extends
		ChartObject<CategorizedSeriesModel, ColumnSkin> implements
		Series<CategorizedSeriesModel> {

	public ColumnSeries(CategorizedSeriesModel model) {
		super(model, new ColumnSkin());
	}

	@SuppressWarnings("unchecked")
	@Override
	protected void caculateChartObjectModelProperties() {
		DisplayObject<?> parent = getParent();
		if (parent != null) {
			ShapeModel<Object> parentModel = (ShapeModel<Object>) parent
					.getData();
			getData().setHeight(parentModel.getHeight());
			getData().setX(parentModel.getX());
			getData().setY(parentModel.getY());
		}
	}

	@Override
	public String getSelectorName() {
		return "ColumnChart#" + getData().getName();
	}

}
